package kr.saeildamil.androidstudy_second.br_service;

import kr.saeildamil.androidstudy_second.R;
import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;

public class MusicService extends Service {
	MediaPlayer mPlayer;
	@Override
	public IBinder onBind(Intent arg0) {
		return null;
	}

	@Override
	public void onCreate() {
		super.onCreate();
		mPlayer = MediaPlayer.create(this, R.raw.oldpop);
		mPlayer.setLooping(false);
	}

	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		super.onStartCommand(intent, flags, startId);
		mPlayer.start();
		return START_STICKY;
		
	}
	
	@Override
	public void onDestroy() {
		super.onDestroy();
		mPlayer.stop();
	}

	

}
